import request from '@/utils/request.js'

// 获取组织架构数据
export function getDepartments() {
  return request({
    url: '/company/department',
    type: 'get'
  })
}

// 根据Id删除部门
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

// 新增部门
export function addDepartments(val) {
  return request({
    url: '/company/department',
    method: 'POST',
    data: val
  })
}

// 根据id获取某个部门的详情
export const getDepartDetail = id => {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

// 封装编辑部门接口
export const updateDepartments = val => {
  return request({
    url: `/company/department/${val.id}`,
    method: 'put',
    data: val
  })
}
